LassoScript Utility
Basics Browse Detail

[Decimal->SetFormat]

Tag Link [Decimal->SetFormat] Category Math
Type Member Source Available No
Support Preferred Version 5.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0

Description

[Decimal->SetFormat] specifies the format in which the decimal value will be output when cast to string or displayed to a visitor.

Options include specifying the character that will be used for the decimal point or thousands group separator, forcing the decimal to display in scientific notation, and options for padding the output.

Syntax

[Decimal Value->(SetFormat:
-DecimalChar=Decimal Point Character,
-GroupChar=Thousands Separator Character,
-Precision=Number of Characters Precision,
-Scientific=Boolean,
-Padding=Number of Characters to Pad Output,
-PadChar=Padding Character,
-PadRight=Boolean]

Parameters

Optional Parameters
-Precision Specifies the desired number of characters of precision. By default values are output with 6 characters of precision.
-DecimalChar Specifies the desired character to use as a decimal point. Defaults to a period.
-GroupChar Specifies the desired character to use for thousands grouping. Defaults to the empty string so thousands grouping is not performed.
-Padding Specifies the desired width in character of the output.
-PadChar Specifies the character to use to pad the output. Defaults to a space.
-PadRight If set to True the output will be padded on the right. By default the output will be padded on the left.
-Scientific If set to True, the output will be in scientific notation. By default, scientific notation will only be used if required.

Examples

To display a dollar amount:

Use the [Decimal->SetFormat] tag to set the precision of the value to 2 decimal places. Thousands grouping can be activated by setting -GroupChar to a comma.

[Variable: 'Dollar_Amount'=(Decimal:'1000000.0')]
[$Dollar_Amount->(SetFormat-Precision=2, -GroupChar=',')]
$[Variable: 'Dollar_Amount']

$1,000,000.00